/*
* @Author: Karry
* @Date:   2017-11-01 09:55:25
* @Last Modified by:   Karry
* @Last Modified time: 2017-11-05 11:08:37
*/

var _db = require('util/db.js');

var _address = {
    // 获取地址列表
    getAddressList : function(resolve, reject){
        _db.request({
            url     : _db.getServerUrl('/shipping/list.do'),
            data    : {
                pageSize : 50
            },
            success : resolve,
            error   : reject
        });
    },
    // 新建收件人
    save : function(addressInfo, resolve, reject){
        _db.request({
            url     : _db.getServerUrl('/shipping/add.do'),
            data    : addressInfo,
            success : resolve,
            error   : reject
        });
    },
    // 更新收件人地址
    update : function(addressInfo, resolve, reject){
        _db.request({
            url     : _db.getServerUrl('/shipping/update.do'),
            data    : addressInfo,
            success : resolve,
            error   : reject
        });
    },
    // 删除收件人
    deleteAddress : function(shippingId, resolve, reject){
        _db.request({
            url     : _db.getServerUrl('/shipping/del.do'),
            data    : {
                shippingId  : shippingId
            },
            success : resolve,
            error   : reject
        });
    },
    // 获取收件人信息
    getAddress : function(shippingId, resolve, reject){
        _db.request({
            url     : _db.getServerUrl('/shipping/select.do'),
            data    : {
                shippingId  : shippingId
            },
            success : resolve,
            error   : reject
        });
    },
}
module.exports = _address;